/**
    @author: administrator
    @date:   2020/12/4
    @note:
**/
package main

import (
	"fmt"
	"net/http"
	"websocket/server"
)

var (
	Port = 7777
)

func main() {
	//定义 ws的连接方法
	http.HandleFunc("/ws",server.WsHandler)


	//注册 html 文件的访问
	http.Handle("/",http.FileServer(http.Dir("./html")))


	//注册普通图片显示
	http.Handle("/img/",http.StripPrefix("/img/",http.FileServer(http.Dir("./html/image"))))


	//注册头像遍历接口
	http.HandleFunc("/api/avaterlist",server.GetAvaterList)


	fmt.Println(fmt.Sprintf("服务器启动成功，地址：http://127.0.0.1:%d",Port))
	http.ListenAndServe(fmt.Sprintf(":%d",Port),nil)
}
